package serializer

import "monitoring-api/models"

// User 用户序列化器
type User struct {
	UserID int64  `json:"user_id"`
	Name   string `json:"name"`
	Token  string `json:"token"`
}

// BuildUser 序列化用户
func BuildUser(user models.User, token string) User {
	return User{
		UserID: user.UserID,
		Name:   user.Name,
		Token:  token,
	}
}

// BuildUserResponse 序列化用户响应
func BuildUserResponse(user models.User, token string) Response {
	return Response{
		Code:    0,
		Message: "获取用户信息成功",
		Data:    BuildUser(user, token),
	}
}
